# $ANTLR 3.1.3 Mar 17, 2009 19:23:44 pavadas.g 2011-11-14 19:55:29

import sys
from antlr3 import *
from antlr3.compat import set, frozenset


# for convenience in actions
HIDDEN = BaseRecognizer.HIDDEN

# token types
EOF=-1
T__8=8
T__7=7
T__6=6
T__5=5
T__4=4

# token names
tokenNames = [
    "<invalid>", "<EOR>", "<DOWN>", "<UP>", 
    "'\\n'", "'o'", "'p'", "'u'", "'t'"
]




class pavadasParser(Parser):
    grammarFileName = "pavadas.g"
    antlr_version = version_str_to_tuple("3.1.3 Mar 17, 2009 19:23:44")
    antlr_version_str = "3.1.3 Mar 17, 2009 19:23:44"
    tokenNames = tokenNames

    def __init__(self, input, state=None, *args, **kwargs):
        if state is None:
            state = RecognizerSharedState()

        super(pavadasParser, self).__init__(input, state, *args, **kwargs)






                


        

              
    # Map variable name to Integer object holding value
    memory = dict()



    # $ANTLR start "prog"
    # pavadas.g:11:1: prog : c '\\n' ;
    def prog(self, ):

        try:
            try:
                # pavadas.g:11:5: ( c '\\n' )
                # pavadas.g:11:7: c '\\n'
                pass 
                self._state.following.append(self.FOLLOW_c_in_prog27)
                self.c()

                self._state.following.pop()
                self.match(self.input, 4, self.FOLLOW_4_in_prog28)




            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass
        return 

    # $ANTLR end "prog"


    # $ANTLR start "c"
    # pavadas.g:12:1: c : ( a | 'o' );
    def c(self, ):

        try:
            try:
                # pavadas.g:12:2: ( a | 'o' )
                alt1 = 2
                LA1_0 = self.input.LA(1)

                if ((6 <= LA1_0 <= 7)) :
                    alt1 = 1
                elif (LA1_0 == 5) :
                    alt1 = 2
                else:
                    nvae = NoViableAltException("", 1, 0, self.input)

                    raise nvae

                if alt1 == 1:
                    # pavadas.g:12:6: a
                    pass 
                    self._state.following.append(self.FOLLOW_a_in_c36)
                    self.a()

                    self._state.following.pop()
                    #action start
                    print("c -> a")
                    #action end


                elif alt1 == 2:
                    # pavadas.g:12:28: 'o'
                    pass 
                    self.match(self.input, 5, self.FOLLOW_5_in_c42)
                    #action start
                    print("c -> o")
                    #action end



            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass
        return 

    # $ANTLR end "c"


    # $ANTLR start "a"
    # pavadas.g:13:1: a : ( 'p' a | 'u' b );
    def a(self, ):

        try:
            try:
                # pavadas.g:13:2: ( 'p' a | 'u' b )
                alt2 = 2
                LA2_0 = self.input.LA(1)

                if (LA2_0 == 6) :
                    alt2 = 1
                elif (LA2_0 == 7) :
                    alt2 = 2
                else:
                    nvae = NoViableAltException("", 2, 0, self.input)

                    raise nvae

                if alt2 == 1:
                    # pavadas.g:13:4: 'p' a
                    pass 
                    self.match(self.input, 6, self.FOLLOW_6_in_a50)
                    self._state.following.append(self.FOLLOW_a_in_a51)
                    self.a()

                    self._state.following.pop()
                    #action start
                    print("a -> p")
                    #action end


                elif alt2 == 2:
                    # pavadas.g:13:28: 'u' b
                    pass 
                    self.match(self.input, 7, self.FOLLOW_7_in_a56)
                    self._state.following.append(self.FOLLOW_b_in_a57)
                    self.b()

                    self._state.following.pop()
                    #action start
                    print("a -> u")
                    #action end



            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass
        return 

    # $ANTLR end "a"


    # $ANTLR start "b"
    # pavadas.g:14:1: b : ( 't' b | 'o' );
    def b(self, ):

        try:
            try:
                # pavadas.g:14:2: ( 't' b | 'o' )
                alt3 = 2
                LA3_0 = self.input.LA(1)

                if (LA3_0 == 8) :
                    alt3 = 1
                elif (LA3_0 == 5) :
                    alt3 = 2
                else:
                    nvae = NoViableAltException("", 3, 0, self.input)

                    raise nvae

                if alt3 == 1:
                    # pavadas.g:14:4: 't' b
                    pass 
                    self.match(self.input, 8, self.FOLLOW_8_in_b65)
                    self._state.following.append(self.FOLLOW_b_in_b66)
                    self.b()

                    self._state.following.pop()
                    #action start
                    print("b -> t")
                    #action end


                elif alt3 == 2:
                    # pavadas.g:14:26: 'o'
                    pass 
                    self.match(self.input, 5, self.FOLLOW_5_in_b69)
                    #action start
                    print("b -> o")
                    #action end



            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass
        return 

    # $ANTLR end "b"


    # Delegated rules


 

    FOLLOW_c_in_prog27 = frozenset([4])
    FOLLOW_4_in_prog28 = frozenset([1])
    FOLLOW_a_in_c36 = frozenset([1])
    FOLLOW_5_in_c42 = frozenset([1])
    FOLLOW_6_in_a50 = frozenset([6, 7])
    FOLLOW_a_in_a51 = frozenset([1])
    FOLLOW_7_in_a56 = frozenset([5, 8])
    FOLLOW_b_in_a57 = frozenset([1])
    FOLLOW_8_in_b65 = frozenset([5, 8])
    FOLLOW_b_in_b66 = frozenset([1])
    FOLLOW_5_in_b69 = frozenset([1])



def main(argv, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr):
    from antlr3.main import ParserMain
    main = ParserMain("pavadasLexer", pavadasParser)
    main.stdin = stdin
    main.stdout = stdout
    main.stderr = stderr
    main.execute(argv)


if __name__ == '__main__':
    main(sys.argv)
